python typeerror can't convert object to 'str' for 'filename'